package no.ntnu.fp.model;

import no.ntnu.fp.storage.DBConnection;

public class User extends ActiveRecord {
	DBConnection db;
	String username;
	String passord;
	String firstname;
	String lastname;
	String birthdate;
	
	public User(String username, String passord, String firstname, String lastname, String birthdate) {
		db = new DBConnection();
		this.username = username;
		this.passord = passord;
		this.firstname = firstname;
		this.lastname = lastname;
		this.birthdate = birthdate;
	}

	@Override
	public void save() {
		String query="insert ignore into Ansatt(brukernavn,passord,fornavn,etternavn,fodselsdato) values (?,?,?,?,?)";
		setPreparedStatement(query);
		
		setString(1, username);
		setString(2, passord);
		setString(3, firstname);
		setString(4, lastname);
		setString(5, birthdate);
		addExecuteAndClosePS();
		closeDBConnection();
	}

	@Override
	public void edit(int index) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void delete() {
		// TODO Auto-generated method stub
		
	}

}
